package com.chenfubing.ps.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chenfubing.ps.entity.Appointment;
import com.chenfubing.ps.mapper.AppointmentMapper;
import com.chenfubing.ps.service.IAppointmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenfubing
 * @since 2020-05-05
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements IAppointmentService {

    @Override
    public void addAppointment(Appointment appointment) {
        baseMapper.insert(appointment);
    }

    @Override
    public void deleteAppointment(int id) {
        baseMapper.deleteById(id);
    }

    @Override
    public Page<Appointment> getAppointmentPage(int pageNum, int pageSize) {
        return baseMapper.getAppointmentPage(new Page<>(pageNum,pageSize));
    }

    @Override
    public List<Appointment> getAppointmentList(LocalDateTime startTime, LocalDateTime endTime, String license) {
        return baseMapper.getAppointmentList(startTime, endTime, license);
    }
}
